<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/7/26 0026
 * Time: 11:01
 */

namespace Home\Behaviors;


use Think\Behavior;

class verifyBehavior extends Behavior
{
    public function run(&$params)
    {
        $userinfo = session('USER_INFO');
        $url = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME;

        if($url == 'Home/Index/login'){
            return true;
        }

        if (!$userinfo) {
            redirect(U('Index/login'), 2 , '您尚未登陆');
            exit();
        }

        if($userinfo != md5('hdqb_admin' . '456123' . 'hdqb')){
            redirect(U('Index/login'), 2 , '您已经退出登陆');
            exit();
        }
    }
}